package cn.iocoder.yudao.module.iot.dal.mysql.scene;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.iot.dal.dataobject.scene.IotSceneConditionDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 场景条件 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface IotSceneConditionMapper extends BaseMapperX<IotSceneConditionDO> {

    default List<IotSceneConditionDO> selectListBySceneId(Long sceneId) {
        return selectList(new LambdaQueryWrapperX<IotSceneConditionDO>()
                .eq(IotSceneConditionDO::getSceneId, sceneId)
                .orderByAsc(IotSceneConditionDO::getPriority));
    }

    default void deleteBySceneId(Long sceneId) {
        delete(new LambdaQueryWrapperX<IotSceneConditionDO>()
                .eq(IotSceneConditionDO::getSceneId, sceneId));
    }

} 